angular.module('starter.controllers', [])

.controller('AppCtrl', function($scope,$timeout, $mdSidenav, $mdUtil, $log) {
  $scope.title1 = 'Button';
  $scope.title4 = 'Warn';
  $scope.isDisabled = true;
  $scope.googleUrl = 'http://baidu.com';

      $scope.toggleLeft = buildToggler('left');
      /**
       * Build handler to open/close a SideNav; when animation finishes
       * report completion in console
       */
      function buildToggler(navID) {
        var debounceFn =  $mdUtil.debounce(function(){
          $mdSidenav(navID)
              .toggle()
              .then(function () {
                $log.debug("toggle " + navID + " is done");
              });
        },200);
        return debounceFn;
      }
      $scope.close = function () {
        $mdSidenav('left').close()
            .then(function () {
              $log.debug("close LEFT is done");
            });
      };
});
